#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
struct Node {
  int l, r, val;
  bool operator<(const Node& o) const { return l < o.l; }
};
int ans;
set<Node> st;
set<Node>::iterator split(int pos) {
  auto it = st.lower_bound(Node{pos, pos, 0});
  if (it != st.end() && it->l == pos) return it;
  --it;
  int l = it->l, r = it->r, v = it->val;
  st.erase(it);
  st.insert(Node{l, pos - 1, v});
  return st.insert(Node{pos, r, v}).first;
}
void solve(int l, int r, int v) {
  auto it2 = split(r + 1);
  auto it1 = split(l);
  for (auto it = it1; it != it2; it++) {
    ans -= it->val * (it->r + 1 - it->l);
  }
  ans += v * (r + 1 - l);
  st.erase(it1, it2);
  st.insert(Node{l, r, v});
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  st.insert(Node{1, n, 1});
  ans = n;
  cin >> m;
  while (m--) {
    int l, r, op;
    cin >> l >> r >> op;
    solve(l, r, op - 1);
  }
  return 0;
}